public class BinarySearch {
    public static boolean BinerySearch(int[] arr, int k){
        int left = 0, right = arr.length-1;
        while(left < right){
            int mid = (left + right) >> 1;
            if(arr[mid] >= k){
                right = mid;
            }
            else {
                left = mid + 1;
            }
        }
        if(arr[left] != k) return false;
        System.out.println(arr[left]);
        return true;
    }
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5};
        boolean flg = BinerySearch(arr, 5);
        System.out.println(flg);
    }
}
